<template>
  <van-row>
    <van-nav-bar title="调用摄像头" left-text="返回" left-arrow @click-left="onClickLeft">
    </van-nav-bar>
    <van-row class="side-nav">
      <h1 class="vant-title">
        <img src="https://img.yzcdn.cn/vant/logo.png">
        <span>使用摄像头</span>
      </h1>
      <van-row>
        <h5>图片展示</h5>
        <img id="myImage">
        <van-button type="default" class="getPhoto" @click="takePicture">拍照</van-button>
      </van-row>
    </van-row>
  </van-row>

</template>

<script>
import { Toast } from 'vant'
import { cameraTakePicture } from '../plugin/camera.js'

export default {
  name: 'camera',
  methods: {
    takePicture () {
      Toast('提示内容')
      cameraTakePicture(function (data) {
        Toast('成功' + data)
      }, function (data) {
        Toast('失败' + data)
      })
    },
    onClickLeft () {
      this.$router.go(-1)
    }
  }
}
</script>

<style scoped>
.van-doc-demo-block__title{
  margin: 0;
  font-weight: 400;
  font-size: 14px;
  color: rgba(69,90,100,.6);
  text-align: left;
}
.side-nav{
  box-sizing: border-box;
  width: 100%;
  padding: 64px 10px 10px;
}
.side-nav .vant-desc{
  margin: 0 0 40px;
  color: #7d7e80;
  font-size: 14px;
  text-align: left;
}
.vant-title{
  font-weight: normal;
  -webkit-user-select: none;
  user-select: none;
  margin: 0 0 16px;
  text-align: left;
}
.side-nav .vant-title img {
  width: 36px;
}
.van-cell__title{
  text-align: left;
}
.comment{
  margin: 10px 0px;
}
.getPhoto{
  width: 100%;
}
#myImage{
  width: 100%;
}
</style>
